/*
 * Copyright 2002-2021 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.spring.sample.graphql;

import io.spring.sample.graphql.jpa.CustomRepositoryFactoryBean;
import io.spring.sample.graphql.jpa.ExtendedJpaRepositoryImpl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.repository.config.BootstrapMode;

/*
底下的repositoryBaseClass = ExtendedJpaRepositoryImpl.class起到最关键替换用处[接口方法扩展]，就算ExtendedJpaRepositoryImpl没有和使用者UnitRepository在
 定义上有共同的interface UnitRepository extends 配对 implements ExtendedJpaRepository<T,ID>接口方法溯源定义，实际也能够运行相同名称参数返回值一致的方法定义体的。
 但是从源代码看起来没有直接继承关系啊？反而导向ExtendedJpaRepositoryImpl有实现一个A(),然后UnitRepository直接声明interface{ A() }就能够套近乎调用执行ExtendedJpaRepositoryImpl实例上实现代码A()。
[思路] https://www.e-learn.cn/topic/94794	 https://stackoverflow.com/questions/18300465/spring-data-jpa-and-querydsl-to-fetch-subset-of-columns-using-bean-constructor-p
repositoryBaseClass=配置项：实际像附加XxxRepositoriy extends ,repositoryBaseClass,基类？
基础入口实际要看 org.springframework.data.repository.core.support.RepositoryComposition
用repositoryBaseClass = CustomQueryDslJpaRepository.class报错Object of class [io.spring.sample.graphql.jpa.CustomQueryDslJpaRepository] must be an instance of interface org.springframework.data.jpa.repository.support.JpaRepositoryImplementation
repositoryFactoryBeanClass配置去掉了 findByPi接口会报错，配置repositoryBaseClass去掉就没有该问题所以更好点。
* */


@EnableJpaRepositories(
	repositoryBaseClass = ExtendedJpaRepositoryImpl.class,
	repositoryFactoryBeanClass = CustomRepositoryFactoryBean.class,
	bootstrapMode= BootstrapMode.LAZY
)
@SpringBootApplication
public class SampleApplication {

	public static void main(String[] args) {
		SpringApplication.run(SampleApplication.class, args);
	}

}
